<?php 
if(!defined('ADMIN')){
	exit('Access Denied');
}

$orderstatus=array(
"-1"=>"废弃",
"0"=>"已下单 未预付",
"1"=>"<font color=red>已预付</font>",
"2"=>"<font color=blue>可接单</font>",
"3"=>"已付款",
"4"=>"已完成",
"5"=>"已评价",
);

$givenstatus=array(

    "0"=>"<font color=red>未下发</font>",
    "1"=>"<font color=green>已下发</font>",

);
?>
<form id="pagerForm" method="post" action="#rel#">
	<input type="hidden" name="pageNum" value="<?=$page?>" />
	<input type="hidden" name="numPerPage" value="<?=$pagesize?>" />
	<input type="hidden" name="orderField" value="<?=$orderField?>" />
	<input type="hidden" name="orderDirection" value="<?=$orderDirection?>" />
        <input type="hidden" name="status" value="<?=$status?>" />
</form>
<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="<?=u(MOD,'list',array('q'=>$q,'jgid'=>$jgid))?>" method="post">
	<div class="searchBar">
		<ul class="searchContent">
			<li>
				<label>订单号：</label>
				<input type="text" name="q" value="<?=$q?>" style="width:200px"  />
			</li>
			<li>
            <button type="submit">查询</button>
			</li>
		</ul>

	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
		</ul>
	</div>
	<table class="table" width="100%" layoutH="118">
		<thead>
			<tr>
				<th width="50" orderField="id" <? if($orderField=="id"){?>class="<?=$orderDirection?>"<?}?>>ID</th>
				<th width="100">订单号</th>
                <th width="120">姓名</th>
                <th width="120">名厨(名店)</th>
                <th width="120">电话</th>
                <th width="200">地址</th>
                <?if(empty($_SESSION['EZ_Admin']['shop_id'])){?>
                <th width="100" orderField="totalprice" <? if($orderField=="totalprice"){?>class="<?=$orderDirection?>"<?}?>>订单总价</th>
                <?}?>
                <th width="100">状态</th>
                <?if(empty($_SESSION['EZ_Admin']['shop_id'])){?>
                    <th width="100" orderField="is_given" <? if($orderField=="is_given"){?>class="<?=$orderDirection?>"<?}?>>下发状态</th>
                <?}?>
                <th width="150" orderField="createtime" <? if($orderField=="createtime"){?>class="<?=$orderDirection?>"<?}?>>下单时间</th>

				<th width="200">操作</th>
			</tr>
		</thead>
        <tbody>
        <?php foreach ($row as $r){?>
		<tr target="id" rel="<?=$r["id"]?>">
				<td class="center"><?=$r["id"]?></td>
                <td class="center"><?=$r["ordersn"]?></td>
                <td class="center"><?=$r["guest_name"]?></td>
                <td class="center"><?=$r["shop_name"]?></td>
                <td class="center"><?=$r["tel"]?></td>
                <td><?=$r["guest_address"]?></td>
 <?if(empty($_SESSION['EZ_Admin']['shop_id'])){?>
                <td class="center">￥<?=number_format($r["totalprice"],2)?></td>
                <?}?>
                <td class="center"><?=$orderstatus[$r["status"]]?></td>
                <?if(empty($_SESSION['EZ_Admin']['shop_id'])){?>
                    <td class="center"><?=$givenstatus[$r["is_given"]]?></td>
                <?}?>
                <td class="center"><?=date("Y-m-d H:i",$r["createtime"])?></td>
                
				<td class="center">

					<a title="查看订单" target="navTab" rel="addedipage81" href="<?=u(MOD,'view',array('id'=>$r['id']))?>" class="btnView">查看</a>
				</td>
		</tr>
        <?php }?>   
		</tbody>
	</table>            
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})" id="PageSize">
				<option value="20" <? if($pagesize==20){ echo 'selected="true"';}?>>20</option>
				<option value="50" <? if($pagesize==50){ echo 'selected="true"';}?>>50</option>
				<option value="100" <? if($pagesize==100){ echo 'selected="true"';}?>>100</option>
				<option value="200" <? if($pagesize==200){ echo 'selected="true"';}?>>200</option>
			</select>
			<span>条，共<?php echo $total;?>条</span>
		</div>
		
		<div class="pagination" targetType="navTab" totalCount="<?php echo $total;?>" numPerPage="<?=$pagesize?>" pageNumShown="10" currentPage="<?=$page?>"></div>

	</div>
</div>    
